﻿<?php
error_reporting(0);
define('IN_QY',true);
session_start();
require("include/common.inc.php");
define('SCRIPT','ad_list');
$diz=trim($_GET['diz']);
if(!$_COOKIE['userid']){
      echo "<script type='text/javascript'>location.href='/wap/mlogin.php';</script>";
      exit;
}
if($_GET["act"]=="repass")
{
		 $sqll="update tbl_address set moren = '0'  where userid=".$_COOKIE['userid'];
	 mysql_query($sqll);
	 $sql="update tbl_address set moren = '1'  where id=".$_GET['id'];
	 mysql_query($sql);
	 mysql_close();
	 echo "<script type='text/javascript'>location.href= 'htshopxiadan.php?fid=".$_GET["diz"]."';</script>";
	 exit;
}
if($_GET["act"]=="del"){
	$id=trim($_GET['id']);
     $sql= "delete  from tbl_address  where id='".$id."'";
     mysql_query($sql);
     mysql_close();
     echo "<script type='text/javascript'>alert('删除成功');location.href='myaddress.php?diz=".$diz."';</script>";
     exit;
}
?>

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title><?=$_COOKIE['shuyu']?>/我的地址</title>
    <link href="/ui//plugins/swiper/swiper.min.css" rel="stylesheet" />
    <link href="/ui/css/Hui.css" rel="stylesheet" type="text/css" />
    <script src="/ui/js/jquery.min.js"></script>
    <style type="text/css">
        .active{
            color:red;
        }
	 #header{width:100%; position:absolute; top:0;}
     #footer{width:100%; height:55px; position:absolute; bottom:0;}	 
     #main{width:100%; overflow: auto; position:absolute; top:45px;bottom:0px;}
    </style>
</head>
<body class="H-flexbox-vertical H-theme-background-color-white">

        <header class="H-header H-theme-background-color-white" id="header">
        <span tapmode="" onclick="H.closeWin();" class="H-icon H-position-relative H-display-inline-block H-float-left H-vertical-middle H-theme-font-color-white H-padding-horizontal-left-10 H-z-index-100"><i class="H-iconfont H-icon-arrow-left H-theme-font-color-black H-font-size-18 H-vertical-middle"></i></span>
       <div class="H-header-title H-center-all H-font-size-18 H-text-show-row-1 H-theme-font-color-black H-position-absolute H-width-100-percent">我的地址</div>
    </header>
    <div id="main">
    <!-- 中间地址 -->
	
																  	  	<?
			if($_GET['page']){
				$count = ($_GET['page']-1)*30+1;
			}else{
				$count = 1;
			}
			$page_sql = "select * from tbl_address where userid='".$_COOKIE['userid']."' order by id desc";
			qy_page($page_sql,30);
			$sql="select * from tbl_address where userid='".$_COOKIE['userid']."' ORDER by id DESC LIMIT $_pagenum,$_pagesize";
			$_id ='&';
			$query=mysql_query($sql);
			while($row=mysql_fetch_array($query)){
			?>
			<div style="height:64px">
<div onclick="window.location.href='?act=repass&id=<?=$row['id']?>&diz=<?=$diz?>'" class="H-flexbox-horizontal H-theme-background-color-white H-border-vertical-bottom-after addre" style="float:left;width:91%">
 <?php if($row['moren']!=0){?>  
            <div class="H-padding-vertical-both-10 H-center-all icon" ><img src="/ui/image/icon2.png" alt="" title="" class="H-display-block" style="width: 20px; height: 15px;margin-top: -42px"></div>
			      <?php } ?> 
            <div class="H-flex-item H-padding-10">
                <div class="H-flexbox-horizontal">
                    <div class="H-flex-item H-font-weight-500 H-text-show-row-1">
                      <?=$row['name']?>
                    </div>
                </div>
             <div class="H-vertical-middle" style="float:right;margin-top:-16px">
                <span class="H-font-size-12 H-theme-font-color-black tel"><?=$row['tell']?></span>
             </div>
                <div class="H-font-size-12 H-theme-font-color-999 H-text-show-row-1 H-margin-vertical-top-2"><?=$row['dizhi']?></div>               
            </div>
        </div>
        <a href="myaddress.php?id=<?=$row['id']?>&diz=<?=$diz?>&act=del" onClick="if (confirm('确定要删除吗？')) return true; else return false;" >
             <div class="H-vertical-middle" >
                 <img src="/ui/image/icon1.png" alt="" title="" class="H-display-block" style="width: 14px; height: 14px;margin-top: 30px;margin-left: 12px">
             </div> </a>
             </div>       
  				<?php
                } 
              ?>
			  
		
	    <!-- 中间地址 -->	
		

       <div style="margin-top:20px">
    <center>
    <button tapmode="" onclick="H.openWin('xinzengdizhi', 'xinzengdizhi.php?diz=<?=$_GET["diz"]?>');" class="H-button H-width-100-percent H-padding-vertical-both-8 H-font-size-18 H-outline-none H-padding-horizontal-both-17 H-theme-background-color8 H-theme-font-color-white H-theme-border-color8 H-theme-border-color8-click H-theme-background-color8-click H-theme-font-color8-click H-border-radius-3" style="width:70%">添加新的地址</button>
    </center>
        </div>
		</div>
<!-- 第二个 -->

<br>
		    <?include('footer.php');?>
     <script src="/ui/script/H.js" type="text/javascript"></script>
     <script src="/ui/js/jquery.min.js" type="text/javascript"></script>
	 <script>
        $(function() {  
		    var tel = $('.tel').html();  
		    var mtel = tel.substr(0, 3) + '****' + tel.substr(7);  
		    $('.tel').text(mtel); 
		   /* var tel = $('#tel').html();
		    alert(tel);
		    var mtel=tel.split('');
		    var mmtel=mtel.splice(3,4,"****");
		    var mmmtel=mtel.join('');
		    alert("mtel:"+mtel);
		    alert("mmtel:"+mmtel);
		    alert("mmmtel:"+mmmtel);
		     $('#tel').text(mmmtel);*/
		});
		/*地址的选中*/
		var addre=$(".addre");
		addre.toggle(function(){
			addre.on('click',function(){
				$(".icon").css("visibility","visible");
			});
		},function(){
			addre.on('click',function(){
				$(".icon").css("visibility","hidden");
			})
		});
		/*addre.each(function(i,it){
			$(this).toggle(function(){

				$(this).on('click',function(){
					$(".icon").css("visibility","visible");
				});
			},function(){
				$(this).on('click',function(){
					$(".icon").css("visibility","hidden");
				});
			});
			
		});	*/
		/*var dis = $(this).find(".icon").css("display");
			var v = $(this).find(".icon").css("visibility");
			$(this).on('click',function(){
				
				if(dis == "-webkit-box" && v == "visible"){
					$(this).find(".icon").css({
						"display":"block",
						"visibility":"visible"
					});
				}else if(dis == "block" && v == "hidden"){
					$(this).find(".icon").css({
						"display":" -webkit-box",
						"visibility":"visible"
					});
				}
			});*/	
    </script>
</body>
</html>